<#assign base=request.contextPath />
<!DOCTYPE html>
<html>
<head>
  <base href="${base}">	
  <meta charset="utf-8">
  <title>日志列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="${base}/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="${base}/layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="${base}/css/my.css" media="all">
</head>

<body>
	<div class="layui-fluid">
		<div class="layui-card">
			<!-- 搜索栏 -->
			<div id="search-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
				<div class="layui-form-pane">
					<div class="layui-form-item">
						<label class="layui-form-label" style="width: 60px;">账号</label>
						<div class="layui-input-inline" style="width: 120px;">
							<input type="text" name="Q_LIKES_loginName" class="layui-input" placeholder="用户账号" />
						</div>
						<label class="layui-form-label" style="width: 60px;">姓名</label>
						<div class="layui-input-inline" style="width: 120px;">
							<input type="text" name="Q_LIKES_realName" class="layui-input" placeholder="用户姓名" />
						</div>
						
						<label class="layui-form-label" style="width: 88px;">操作时间</label>
						<div class="layui-input-inline" style="width: 120px;">
							<input type="text" id="begin" name="Q_GED_ctime" class="layui-input" placeholder="开始时间" />
						</div>
						<div class="layui-input-inline" style="width: 120px;">
							<input type="text" id="end" name="Q_LTD_ctime" class="layui-input" placeholder="结束时间" />
						</div>
																			
						<div class="layui-input-inline">
							<div class="layui-btn-group">
								<button class="layui-btn" lay-submit lay-filter="LAY-search">
	            					<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> 检索
	          					</button>
								<button class="layui-btn layui-btn-danger" id="LAY-reset" lay-filter="LAY-reset">
	            					<i class="layui-icon layui-icon-close layuiadmin-button-btn"></i> 清空
	          					</button>
							</div>
						</div>
					</div>
				</div>
			</div>			
			<!-- 表格 -->
			<div class="layui-card-body">
				<table id="LAY-table" lay-filter="LAY-table"></table>
			</div>
		</div>
	</div>

	<!-- 自定义模板 -->
	
  	<script src="${base}/layuiadmin/layui/layui.js"></script>
  	<script>
  	layui.config({
    	base: '${base}/layuiadmin/' //静态资源所在路径
  	}).extend({
    	index: 'lib/index',
    	jwt: '{/}${base}/js/lib/jwt'
  	}).use(['index', 'table', 'jwt', 'laydate'], function(){
    	var table = layui.table;
    	var form = layui.form;
    	var jwt = layui.jwt;
    	var laydate = layui.laydate;
    	var $ = layui.$;
    	
    	// 日期选择
    	laydate.render({
    		elem: '#begin'
    	});
    	laydate.render({
    		elem: '#end'
    	});
    	
    	// 创建表格
        table.render({
			elem: '#LAY-table',
			even: true,  //开启隔行背景
			size: 'sm',  //小尺寸的表格
			height: 'full-130',  //容器高度
			cols: [[
				{checkbox: true},
				{title: '#', type:'numbers', align: 'center', width: 40}, 
				{title: '账号', align:'center', field: 'loginName', width: 100},  
				{title: '姓名', align:'center', field: 'realName', width: 100},
				{title: '单位名称', align:'center', field: 'deptName', width: 150},
				{title: 'IP', align:'center', field: 'ip', width: 110},
				{title: '操作时间', align:'center', field: 'ctime', width: 170, sort:true},
				{title: '操作模块', align:'center', field: 'module', width: 120},
				{title: '日志内容', align:'center', field: 'msg'},
				{title: '客户端标识', align:'center', field: 'client', width: 200}
			]], 
			url: '${base}/comm/log/list',
			headers: {
				'Authorization': jwt.getCookie('token')
			},
			page: true, 
			limits: [15, 30, 50, 100, 200], 
			limit: 15,  //默认采用25
			loading: true, 
			autoSort: false,
			done: function (res, curr, count) {}
		});  
    	
     	// 排序
        table.on('sort(LAY-table)', function(obj) {
        	table.reload('LAY-table', {
        		initSort: obj,
        		where: obj
        	})
        });
    	
      	//监听搜索
    	form.on('submit(LAY-search)', function(data) {
      		var field = data.field;      
      		//执行重载
      		table.reload('LAY-table', {
        		where: field,
        		page: {curr: 1}
      		});
    	});    
    	//重置
    	$('#LAY-reset').click(function() {
    		$('#search-form :input').val('');
    	});
    	
  	});
  	
  	
  </script>
</body>
</html>
